<?php

namespace IDock\Insurance\AMIC\Request;

use IDock\Insurance\AMIC\AMICEnums;
use IDock\Insurance\AMIC\Request\AllAMICRequest;
use IDock\Insurance\AMIC\Response\VehicleConfirmResponse;
use IDock\Insurance\AMIC\Response\VehicleModelResponse;
use IDock\Visitor\Premium\PremiumInquiryVisitor;
use IDock\Visitor\VehicleModelVisitor;

class VehicleConfirmRequest extends AllAMICRequest
{
    public $requestType = 'N0215';

    protected $response = VehicleConfirmResponse::class;

    protected $urlTip = '车型确认';

    /*** @var  PremiumInquiryVisitor $visitor */
    protected $visitor;

    public function generate(): array
    {
        return [
            'vehicleModel' => [
                'licensePlateNo' => $this->visitor->getVehicleVisitor()->licenseNo,
                'licensePlateType' => !empty($this->visitor->getVehicleVisitor()->licenseNo) ? (AMICEnums::$licenseTypeCode[$this->visitor->getVehicleVisitor()->licenseTypeCode] ?? '' ): '',//车辆种类
                'engineNo' => $this->visitor->getVehicleVisitor()->engineNo,
                'vin' => $this->visitor->getVehicleVisitor()->vin,
                'firstRegisterDate' => $this->visitor->getVehicleVisitor()->firstRegisterDate,
                'vehicleId' => $this->visitor->getVehicleVisitor()->vehicleModelCode,
                'orderNo' => $this->visitor->getExtInfoVisitor()->argc['orderNo'] ?? ''
            ]
        ];
    }
}
